# Maintainer: Ryuta Suzuki <oroppas@gmail.com>

_realname=decorator
pkgbase=mingw-w64-python-${_realname}
pkgname=("${MINGW_PACKAGE_PREFIX}-python3-${_realname}" "${MINGW_PACKAGE_PREFIX}-python2-${_realname}")
pkgver=4.3.0
pkgrel=1
pkgdesc="Better living through Python with decorators (mingw-w64)"
arch=('any')
license=('BSD')
url="https://github.com/micheles/decorator"
makedepends=("${MINGW_PACKAGE_PREFIX}-python3-setuptools"
             "${MINGW_PACKAGE_PREFIX}-python2-setuptools"
             'git')
source=("${_realname}-${pkgver}.tar.gz::https://github.com/micheles/${_realname}/archive/${pkgver}.tar.gz")
sha256sums=('049deb70d6348f665372a1c622a9fcc4e227a0c4976fe0cfd0df89594c149c4e')

prepare() {
  cp -a ${_realname}-${pkgver}{,-py2}
}

build() {
  cd ${srcdir}/${_realname}-${pkgver}
  python3 setup.py build

  cd ${srcdir}/${_realname}-${pkgver}-py2
  python2 setup.py build
}

package_python3-decorator() {
  depends=("${MINGW_PACKAGE_PREFIX}-python3")

  cd ${_realname}-${pkgver}
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python3 setup.py install --root=${pkgdir} --prefix=${MINGW_PREFIX} --optimize=1
  install -D -m644 LICENSE.txt ${pkgdir}${MINGW_PREFIX}/share/licenses/python3-${_realname}/LICENSE
}

package_python2-decorator() {
  depends=("${MINGW_PACKAGE_PREFIX}-python2")

  cd ${_realname}-${pkgver}-py2
  MSYS2_ARG_CONV_EXCL="--prefix=;--install-scripts=;--install-platlib=" \
  ${MINGW_PREFIX}/bin/python2 setup.py install --root=${pkgdir} --prefix=${MINGW_PREFIX} --optimize=1
  install -D -m644 LICENSE.txt ${pkgdir}${MINGW_PREFIX}/share/licenses/python2-${_realname}/LICENSE
}

package_mingw-w64-i686-python2-decorator() {
  package_python2-decorator
}

package_mingw-w64-i686-python3-decorator() {
  package_python3-decorator
}

package_mingw-w64-x86_64-python2-decorator() {
  package_python2-decorator
}

package_mingw-w64-x86_64-python3-decorator() {
  package_python3-decorator
}

# vim:set ts=2 sw=2 et:
